'use strict';
let db = require('../model/db.js');
let date = require('date-and-time');


module.exports = (req,res)=>{
    let user = req.body.user;
    let bankname = req.body.bankname;
    let billdata = req.body.billdata;
    let duedata = req.body.duedata;
    let now = new Date();
    let strNow = date.format(now, 'YYYY/MM/DD HH:mm:ss');
    db.insert('info',{
        docs:{
            user : user,
            bankname : bankname,
            billdata : billdata,
            duedata : duedata,
            createTime : now,
        },
        callback:(err,result)=>{
            if(err){
                res.json(err);
                return;;
            }
            res.json(result);
        }
    });
}